from bow_search_engine import BOWSearchEngine

if __name__ == '__main__':
    # 创建搜索引擎对象
    search_engine = BOWSearchEngine()

    # 添加语料
    for i in range(1, 6):
        search_engine.add_corpus(f'{i}.txt')

    # 接收用户输入
    while True:
        query = input('please input query: \n')
        if query == 'quit':
            print('bye bye~')
            break
        result = search_engine.search(query)
        print(f'found {len(result)} result(s)')
        for r in result:
            print(r)
